package com.ocom.payconfig.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ocom.common.entity.card.EntityKitchenPrtScheme;
import com.ocom.common.vo.payconfig.kitchenprinter.GetSchemeOnPrtInfoDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IDaoKitchenPrtScheme extends BaseMapper<EntityKitchenPrtScheme> {


    @Select({"<script>",
            "SELECT\n" +
                    "\tP.*,\n" +
                    "\tS.*\n" +
                    "FROM\n" +
                    "\tkitchen_prt_scheme S,\n" +
                    "\tkitchen_prt_info P\n" +
                    "WHERE\n" +
                    "\tP.com_id = #{comId}\n" +
                    "AND P.rest_id = #{restId}\n" +
                    "AND P.prt_id = S.k_prt_id\n" +
                    "AND P.product = #{ifMaster}\n" +
                    " <when test=\"strArea!=null and strArea!=''\" > "+
                    "AND ${strArea}" +
                    "</when>" +
                    "</script>"})
    List<GetSchemeOnPrtInfoDto> getSchemeOnPrtInfo(@Param("comId") Long comId, @Param("restId") Long restId, @Param("ifMaster") Integer ifMaster, @Param("strArea") String strArea);


    @Select({"<script>",
            "SELECT\n" +
                    "\tP.*,\n" +
                    "\tS.*\n" +
                    "FROM\n" +
                    "\tkitchen_prt_scheme S,\n" +
                    "\tkitchen_prt_info P\n" +
                    "WHERE\n" +
                    "\tP.com_id = #{comId}\n" +
                    "AND P.product =  #{product} \n" +
                    "AND S.if_order_sum = 1 \n" +
                    "</script>"})
    List<GetSchemeOnPrtInfoDto> getSchemeOnPrtInfo1(@Param("comId") Long comId,@Param("product") Integer product);

}
